<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>个人信息</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css">
    <link rel="stylesheet" href="layui/css/layui.css">
    <link rel="stylesheet" href="layui/css/modules/layer/default/layer.css">
    <link rel="stylesheet" href="css/index.css">
    <style>
        .white,
        body {
            width: 950px;
            margin: 0 auto;
            box-shadow: none;
        }

        .navimg {
            width: 60px;
            height: 65px;
            vertical-align: middle;
            float: left;
            margin-left: 70px;
        }

        .home {
            width: 60px;
            height: 65px;
            vertical-align: middle;
            float: right;
            margin-right: 70px;
        }

        .nav span {
            display: inline-block;
            font-size: 30px;
            font-weight: bold;
            vertical-align: middle;
            margin-left: 220px;
            margin-top: 10px;
        }

        .contentLeft {
            width: 200px;
            height: 600px;
            float: left;
            background-color: #fff;
            border: 1px solid #f8f8fa;
            margin-top: 66px;
        }

        .head {
            text-align: center;
            height: auto;
        }

        .head h1 {
            width: 160px;
            text-align: center;
            height: 30px;
            line-height: 30px;
            font-size: 20px;
            margin: 0 auto;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            cursor: pointer;
        }

        .head_img {
            width: 80px;
            height: 80px;
            border-radius: 40px;
            margin: 20px auto 10px;
            overflow: hidden;
            cursor: pointer;
        }

        .head_img img {
            width: 100%;
        }

        hr {
            margin-top: 20px;
            margin-bottom: 20px;
            border: 0;
            border-top: 1px solid #eee;
        }

        .money,
        .credit {
            width: 98%;
            height: 34px;
            line-height: 34px;
            border-radius: 4px;
            background-color: rgb(79, 190, 246);
            color: rgba(255, 255, 255, 1);
            text-align: center;
            vertical-align: middle;
            cursor: pointer;
            white-space: nowrap;
            font-size: 14px;
            margin-bottom: 20px;
        }

        .home_nav img {
            width: 35px;
            height: 33px;
            float: left;
            margin: 4px 8px 0 15px;
        }

        .home_nav li {
            width: 150px;
            height: 40px;
            margin: 5px 25px;
            color: #b4b4b4;
            float: left;
            border-radius: 25px;
            cursor: pointer;
        }

        .home_nav li span {
            float: left;
            font-size: 15px;
            line-height: 40px;
        }

        .home_nav ul li:hover {
            background-color: rgba(0, 169, 255, 0.61);
            color: #fff;
        }

        .main {
            width: 745px;
            height: auto;
            float: right;
            margin-top: 66px;
            padding: 50px;
            box-sizing: border-box;
        }

        .main .mset h1 {
            font-size: 36px;
            text-align: center;
            margin-bottom: 30px;
        }

        .main .mset ul li {
            width: 100%;
            height: 100px;
            border-top: 1px solid #ccc;
            line-height: 100px;
            font-size: 15px;
            color: #969696;
        }

        .main .set ul li span {
            margin-left: 120px;
        }

        .main .mset ul li input {
            float: right;
            margin-right: 230px;
            margin-top: 34px;
            padding: 5px 10px;
            font-size: 15px;
            border: 1px solid #c8c8c8;
            border-radius: 4px;
            background-color: hsla(0, 0%, 71%, .1);
        }

        #mset button {
            width: 120px;
            margin: 10px 50px 60px 250px;
            border-radius: 4px;
            border: none;
            background-color: #3db922;
            color: #fff;
            padding: 10px 10px;
            cursor: pointer;
        }

        .main .msecond h1 {
            font-size: 36px;
            text-align: center;
            margin-bottom: 30px;
        }

        .main .msecond ul li {
            width: 350px;
            height: auto;
            background: #fff;
            box-shadow: 7px 7px 20px 0 #e8e9eb;
            margin: 0 auto;
            margin-bottom: 20px;
            padding: 20px;
            padding-left: 50px;
            box-sizing: border-box;
        }

        .main .msecond ul li h1 {
            font-size: 20px;
            text-align: left;
            margin-bottom: 10px;
        }

        .main .msecond ul li p {
            font-size: 16px;
            color: #4fbef6;
        }

        .main .msecond ul li img {
            width: 240px;
            height: 200px;
            vertical-align: bottom;
            margin-top: 10px;
        }

        .main .msecond ul li > span {
            color: #939cac;
            vertical-align: bottom;
            margin-left: 30px;
        }

        .main .msecond ul li p:nth-of-type(2) {
            color: #4fbef6;
            font-size: 16px;
            margin-top: 10px;
        }

        .mfir span:hover{
            color: deepskyblue;
            text-decoration: underline;
        }

        .pay,.removeFocus{
            margin-left: 5px !important;
            margin-top: 5px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            padding: 5px 5px;
            border-radius: 4px;
            border: none;
            background-color: #4fbef6;
        }
        .main .mset li span{
            margin-left: 100px;
        }
        .main .getCateLog{
            width: 33%;
            float: right;
            margin-right: 230px;
            margin-top: 34px;
            padding: 5px 10px;
            font-size: 15px;
            border: 1px solid #c8c8c8;
            border-radius: 4px;
            background-color: hsla(0, 0%, 71%, .1);
        }
        [placeholder]{
            font-weight: normal !important;
        }
        .mstore textarea{
            width: 33%;
            height: 70px;
            border: 1px solid #c8c8c8;
            vertical-align: middle;
            float: right;
            margin-right: 230px;
            margin-top: 15px;
        }
        .mstore li:nth-of-type(5) span{
            margin-bottom: 40px;
            vertical-align: middle;
        }
        .layui-btn{
            background-color: rgb(79, 190, 246);
            margin-left: 85px;
        }
        #Uimg{
            width: 100%;
            height: 200px;
        }
        .layui-upload-list{
            width: 33%;
            height: 200px;
            margin-right: 230px;
            float: right;
        }
        .publishGoods{
            width: 120px;
            margin: 10px 50px 60px 200px;
            border-radius: 4px;
            border: none;
            background-color: rgb(79, 190, 246);
            color: #fff;
            padding: 10px 10px;
            cursor: pointer;
        }

        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }
        .mmoney img{
            width: 20%;
            margin-bottom: 20px;
        }
        .mmoney{
            text-align: center;
        }
        .mmoney button {
            width: 120px;
            margin: 10px 50px 60px 45px;
            border-radius: 4px;
            border: none;
            background-color: rgb(79, 190, 246);
            color: #fff;
            padding: 10px 10px;
            cursor: pointer;
        }
        .mconform{
            width: 70%;
            margin: 0 auto;
        }

        .main .mconform ul li{
            height: 60px;
            line-height: 60px;
            text-align: left;
            padding-left: 100px;
            box-sizing: border-box;
        }
        .main .mconform ul li span{
            margin-left: 40px;
        }
        .main .mconform ul li:nth-of-type(1){
           border: none;
        }
        .main .mconform ul li:nth-of-type(2){
            line-height: 200px;
            height: 200px;
        }
        .main .mconform ul li:nth-of-type(2) img{
            width: 140px;
            height: 140px;
        }
        .main .mconform ul li:nth-of-type(4) span{
            font-size: 15px;
            color: #969696;
            font-weight: normal;
        }
        .main .mconform ul li:nth-of-type(5){
            height: 150px;
        }
        .main .mconform ul li:nth-of-type(5) input{
            font-size: 15px;
            color: #969696;
            font-weight: normal;
        }
        .buyGoods{
            text-align: center;
            background-color: #fff;
        }
        .buyGoods textarea{
            width: 200px;
            height: 100px;
            border: 1px solid #c8c8c8;
            margin-top: 20px;
        }
        .button button{
            width: 120px;
            float: left;
            border-radius: 4px;
            border: none;
            background-color: rgb(79, 190, 246);
            color: #fff;
            padding: 10px 10px;
            margin-top: 10px;
            margin-left: 20px;
            cursor: pointer;
        }
        td button{
            width: 80px;
            border-radius: 4px;
            border: none;
            background-color: rgb(79, 190, 246);
            color: #fff;
            padding: 10px 10px;

        }
        .main .mnotice{
            margin: 0 auto;
        }
        .main .mnotice table{
            background-color: #fff;
            margin: 0 auto;
        }
        .main .mnotice th,td{
            height: 50px;
            width: 100px;
            border: 1px solid #c8c8c8;
        }
        .delete{
            margin-left: 5px !important;
            margin-top: 5px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            padding: 5px 5px;
            border-radius: 4px;
            border: none;
            background-color:#4fbef6;
        }
    </style>
</head>

<body>

<div class="nav white">
    <a href="/index" target="blank"><img src="img/nav.png" class="navimg"></a>
    <span>闲易校园二手物品交易平台</span>
    <a href="/user"><img src="img/home.png" class="home"></a>
</div>
<div class="contentLeft">
    <div class="head">
        <div class="head_img">
            <a href="/user"> <img src="img/photo.jpg"></a>
        </div>
        <h1 class="username"></h1>
    </div>
    <hr>
    <p class="money">我的钱包：<span></span></p>
    <div class="home_nav">
        <ul>
            <li class="notice">
                <img src="img/dingdanzhongxin.png">
                <span>订单中心</span>
            </li>

            <li class="fri">
                <img src="img/shoucang.png">
                <span>关注列表</span>

            </li>

            <li class="store">
                <img src="img/fabu.png">
                <span>发布物品</span>
            </li>
            <li class="second">
                <img src="img/wodewupin.png">
                <span>我的闲置</span>

            </li>
            <li class="set">
                <img src="img/shezhi.png">
                <span>个人设置</span>
            </li>

        </ul>
    </div>
</div>
<div class="main">
    <div class="mymoney mset" id="mymoney">
        <h1>我的钱包</h1>
        <div class="mmoney">
            <img src="img/money.png">
            <ul>
                <li>
                    <span>余额</span>
                    <input type="text" disabled="disabled">
                </li>
                <li>
                    <span>充值</span>
                    <input type="text" class="purse">
                </li>
            </ul>
            <button class="confirmMoney">充值</button>
        </div>
    </div  >
    <div class="mnotice mset" style="display:none;" id="mnotice">
        <h1>订单中心</h1>
        <table border="1" width="80%" class="myjob">
            <tr align="center">
                <th>订单编号</th>
                <th>名称</th>
                <th>价格</th>
                <th>备注</th>
                <th>操作</th>
            </tr>


        </table>
    </div>
    <div class="mfri share msecond" style="display: none" id="mfri">
        <!--<h1>我的闲置</h1>-->
        <!--<ul>-->

        <!--<li>-->
        <!--<h1>${data[i].name}</h1>-->
        <!--<p>${data[i].describle}</p>-->
        <!--<img src="">-->
        <!--<span>${data[i].startTime}</span>-->
        <!--<p>下架时间：<span>${data[i].endTime}</span></p>-->
        <!--</li>-->

        <!--</ul>-->
    </div>
    <div class="mstore mset" style="display: none" id="mstore">
        <h1>发布物品</h1>
        <form enctype="multipart/form-data" id="uploadForm">
            <ul>
                <li>
                    <span>物品名：</span>
                    <input type="text" class="name" placeholder="请输入物品名">
                </li>
                <li>
                    <span>出售价格：</span>
                    <input type="text" class="mprice" placeholder="请输入出售价格">
                </li>
                <li><span>原价：</span>
                    <input type="text" class="realPrice" placeholder="请输入商品原价"></li>
                <li>
                    <span>物品类别：</span>
                    <select name="" class="getCateLog">

                    </select>
                </li>
                <li>
                    <span>商品描述：</span>
                    <textarea  class="describle"></textarea>
                </li>
                <li>
                    <input type="file" name="" id="uploadimg">
                    <div class="layui-upload-list">
                        <img class="layui-upload-img" id="Uimg">
                    </div>
                </li>
            </ul>
        </form>
        <button class="publishGoods">发布物品</button>
    </div>
    <div class="msecond" style="display: none" id="msecond">


    </div>

    <div class="mset" style="display: none" id="mset">
        <h1>完善与修改个人信息</h1>
        <ul>
            <li>
                <span>昵称：</span>
                <input type="text" class="username" id="username">
            </li>
            <li>
                <span>开通时间：</span>
                <input type="text" class="createAt" disabled="disabled">
            </li>
            <li><span>QQ：</span>
                <input type="text" class="qq"></li>
        </ul>
        <button>保存修改信息</button>
    </div>








    <div class="mconform mset" style="display: none" id="mconform">
        <h1>确认订单</h1>
        <ul class="buyGoods">
            <li>订单编号：<span class="orderNum"></span></li>
            <li>图片：<img class="imgUrl"></li>
            <li>名称：<span class="name"></span></li>
            <li>价格：<span class="price"></span></li>
            <li>备注：<textarea type="text" class="orderinformation"></textarea></li>
            <li class="button">
            </li>

        </ul>

    </div>


</div>
<script src="layui/layui.all.js"></script>
<script src="js/jquery-1.10.1.min.js"></script>
<script src="js/index.js"></script>
<script src="js/url.js"></script>
<script>



    var goodsid = ARR['id'];

    var push=ARR["push"];
    var pull=ARR["pull"];

    var remove=ARR["remove"];
    var myFree=ARR["myFree"];
    var mSet=ARR["mSet"];
    if(mSet!=undefined){
        $.ajax({
            type: "post",
            url: "/user/getPeoInfos",
            dataType: "json",
            success: function (data) {
                var data = data.data;
                $(".mmoney li:nth-of-type(1) input").val(data.balance);
                $(".money span").html(data.balance);
                $(".username").html(data.username);
            }
        });
        $("#mymoney").hide();
        getPeoInfos();

        $("#mset").show();

    }
    if(pull!=undefined){
        allFocus();
        $("#mymoney").hide();
        $("#mfri").show();
    }
    if(myFree!=undefined){
        myIdleGoods();
        $("#mymoney").hide();
        $("#msecond").show();
    }
    if(remove!=undefined){
        allFocus();
        $("#mymoney").hide();
        $("#mfri").show();

    }
    if(push!=undefined){
        getCateLog();
        $("#mymoney").hide();
        $("#mstore").show();
    }


    if(goodsid!=undefined){
        buyGoods(goodsid);
        $("#mymoney").hide();
        $("#mconform").show();
    }
    /**
     * 查找钱包
     * */

        $.ajax({
            type: "post",
            url: "/user/getPeoInfos",
            dataType: "json",
            success: function (data) {
                var data = data.data;
                $(".mmoney li:nth-of-type(1) input").val(data.balance);
                $(".money span").html(data.balance);
                $(".username").html(data.username);
            }
        });





    
    function buyGoods(goodsId){

        $.ajax({
            type: "post",
            url: "/goods/buyGoods",
            data:{
                goodsId:goodsId
            },
            dataType: "json",
            success: function (data) {
                var data = data.data;
                var price=data.price;
                var balance=data.balance;
                $(".orderNum").html(data.orderNum);
                $(".price").html(data.price);
                $(".name").html(data.name);
                $(".imgUrl").attr("src","/upload/goods/"+data.imgUrl);

                var html="";
                if(price>balance){
                    html+=`<button class="cancelpay">取消支付</button>
                <button class="goPay">请充值</button>`;
                }else{
                    html+=`<button class="cancelpay">取消支付</button>
                <button class="PPay">购买</button>`;
                }
                $(html).appendTo(".button");
            }
        });
    }

    /**
     * 取消支付
     * */
    $("body").on("click",".cancelpay",function () {
        window.open("/detail?id=" + goodsid);
    })

    /**
     * 支付
     * */
    function addOrder(orderNum,goodsId,orderInformation){
        $.ajax({
            type: "post",
            url: "/goods/addOrder",
            dataType: "json",
            data:{
                orderNum:orderNum,
                goodsId:goodsId,
                orderInformation:orderInformation
            },
            success: function (data) {
                if(data.code==1){
                    layer.open({
                        title: '信息',
                        content: '购买成功！',
                        yes:function () {
                            $.ajax({
                                type: "post",
                                url: "/user/getPeoInfos",
                                dataType: "json",
                                success: function (data) {
                                    var data = data.data;
                                    $(".mmoney li:nth-of-type(1) input").val(data.balance);
                                    $(".money span").html(data.balance);
                                    $(".username").html(data.username);
                                }
                            });
                            $("#mconform").hide();
                            getOrderses();
                            $("#mnotice").show();
                            layer.closeAll();
                        }
                    });

                }
            }
        });
    }
    $("body").on("click",".PPay",function () {
        var orderNum=$(".orderNum").html();
        var orderinformation=$(".orderinformation").val();

        if(orderinformation==""|| orderinformation==null){
            layer.msg("请填写备注！");
            return;
        }

        addOrder(orderNum,goodsid,orderinformation)

    })
    /**
     *
     * */
    $("body").on("click",".goPay",function () {
        window.location.href="/user";
    })


    $("#uploadimg").change(function () {
        //$('#filed')获取的是jQuery对象，.get(0)转为原生对象;
        //这边默认只能选一个，但是存放形式仍然是数组，所以取第一个元素使用[0];
        var file = $('#uploadimg').get(0).files[0];
        if(file.type.substring(0,5)!="image"){
            layer.msg("请选择图片！");
            return;
        }else if((file.size/1024/1024)>5){
            layer.msg("文件大小限制5M！");
            return;
        }

        //创建用来读取此文件的对象
        var reader = new FileReader();
        //使用该对象读取file文件
        reader.readAsDataURL(file);
        //读取文件成功后执行的方法函数
        reader.onload=function(e){
            //读取成功后返回的一个参数e，整个的一个进度事件
            //选择所要显示图片的img，要赋值给img的src就是e中target下result里面
            //的base64编码格式的地址
            $('#Uimg').get(0).src = e.target.result;
        }
    })

    $(".publishGoods").click(function () {
        var formData = new FormData($("#uploadForm")[0]);
        console.log(formData);
        var name=$(".name").val();
        var price=Number($(".mprice").val());
        var real_price=Number($(".realPrice").val());
        var cateId=Number($(".getCateLog").val());
        var describle=$(".describle").val();
        var goodsImg = $('#uploadimg').get(0).files[0];

        if(name=="" || name==null || price=="" || price==null || real_price=="" || real_price==null || describle=="" || describle==null || goodsImg==null){
            layer.msg("保证信息完整！");
            document.getElementById("uploadForm").reset();
            $("#Uimg").attr("src","");
            return;
        }


        formData.append('name', name);
        formData.append('price', price);
        formData.append('real_price', real_price);
        formData.append('cateId', cateId);
        formData.append('describle', describle);
        formData.append('goodsImg', goodsImg);

        //console.log(formData.get("goodsImg"))
        publishGoods(formData);

    })
    /**
     * 发布物品
     **/
    function publishGoods(formData) {
        $.ajax({
            type: "post",
            url: "/goods/publishGoods",
            data:formData,
            dataType: "json",
            processData: false,
            contentType: false,
            cache: false,
            success: function (data) {
                if(data.code==1){
                    layer.open({
                        title: '信息',
                        content: '发布成功！',
                        yes: function () {
                            $("#mstore").hide();
                            window.location.href="/user?myFree=1";

                        }
                    });
                }else if(data.code==0){
                    layer.msg("发布失败！")
                }
            }
        });
    }

    function getPeoInfos() {
        $.ajax({
            type: "post",
            url: "/user/getPeoInfos",
            dataType: "json",
            success: function (data) {
                var data = data.data;

                $(".username").val(data.username);
                $(".createAt").val(data.createAt);
                $(".qq").val(data.qq);

            }
        });
    }




    $("#mset button").click(function () {
        var name = $("#username").val();
        var qq = $(".qq").val();
        changePeoInfos(name, qq);
    });

    //点击更改信息
    function changePeoInfos(name, qq) {

        $.ajax({
            type: "post",
            url: "/user/changePeoInfos",
            data: {
                username: name,
                qq: qq
            },
            dataType: "json",
            success: function (data) {

                if (data.code == 1) {
                    layer.open({
                        title: '信息',
                        content: '修改成功！',
                        yes: function () {
                            window.location.href="/user?mSet=1";
                        }
                    });
                } else if (data.code == 0) {
                    layer.open({
                        title: '信息',
                        content: '修改失败！',
                    });
                }


            }
        });
    }


    function myIdleGoods() {
        $.ajax({
            type: "post",
            url: "/goods/myIdleGoods",
            dataType: "json",
            success: function (data) {
                var data = data.data;
                var html = "";
                $("#msecond").empty();
                html += `<h1>我的闲置</h1><ul>`;
                for (var i = 0; i < data.length; i++) {
                    html += `<li>
                                 <h1>${data[i].name}</h1>
                                <p>${data[i].describle}</p>
                                <img src="${"/upload/goods/" + data[i].imgUrl}">
                                <p>上架时间：${data[i].startTime}</p>
                                <p>下架时间：<span>${data[i].endTime}</span></p>
                                <button data-id="${data[i].id}" class="delete">删除</button>
                              </li>`;
                }
                html += `</ul>`;
                $(html).appendTo("#msecond");

            }
        });
    }


    function allFocus() {
        $.ajax({
            type: "post",
            url: "/focus/allFocus",
            dataType: "json",
            success: function (data) {
                var data = data.data;
                var html = "";
                $(".mfri").empty();
                html += `<h1>关注列表</h1><ul>`;
                for (var i = 0; i < data.length; i++) {
                    html += `<li>
                                 <h1>${data[i].name}</h1>
                                <p>${data[i].content}</p>
                                <img src="/upload/goods/${data[i].imgUrl}">

                                <button data-id="${data[i].id}" class="pay">前往购买</button> <button data-id="${data[i].id}" class="removeFocus">取消关注</button>
                              </li>`;
                }
                html += `</ul>`;
                $(html).appendTo(".mfri");

            }
        });
    }

    $("body").on("click",".removeFocus",function () {
        $.ajax({
            type: "post",
            url: "/focus/removeFocus",
            data: {
                goodsId: $(this).data("id")
            },
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    layer.open({
                        title: '信息',
                        content: '取注失败！'
                    });
                } else if (data.code == 1) {
                    layer.open({
                        title: '信息',
                        content: '取注成功！',
                        yes:function () {
                            window.location.href="/user?remove=1";
                        }
                    });

                }
            }
        });
    })
    $("body").on("click",".pay",function () {
        window.open("/detail?id=" + $(this).data("id"));
    })


    /**
     * 加载商品类别
     */
    function getCateLog() {
        $(".getCateLog").html("");
        $.ajax({
            type: "post",
            url: "/catelog/getCateLog",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    layer.open({
                        title: '信息',
                        content: '获取物品类别失败！'
                    });
                } else if (data.code == 1) {
                    var data=data.data;
                    var html="";
                    for (let i = 0; i < data.length; i++) {
                        html+=`<option data-id="${data[i].id}" value="${data[i].id}">${data[i].name}</option>`;
                    }
                    $(html).appendTo(".getCateLog");
                }

            }
        });
    }

    /**
     * 充值
     */
    $(".confirmMoney").click(function () {
        var money=$(".purse").val();
        location.href="/alipay?money="+money
        /*$.ajax({
            type: "post",
            url: "/purse/recharge",
            data:{
                money:money
            },
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    layer.open({
                        title: '信息',
                        content: '充值失败！'
                    });
                } else if (data.code == 1) {
                    layer.open({
                        title: '信息',
                        content: '充值成功！',
                        yes:function () {
                            window.location.reload();
                        }
                    });
                }

            }
        });*/
    })


    //点击发布物品
    $(".store").click(function () {
        $("#mset").hide();
        $("#msecond").hide();
        $("#mfri").hide();
        $("#mnotice").hide();
        $("#mymoney").hide();
        $("#mstore").show();
        $("#mconform").hide();
        getCateLog();
    })
    //点击我的闲置
    $(".second").click(function () {
        $("#mset").hide();

        $("#mfri").hide();
        $("#mnotice").hide();
        $("#mstore").hide();
        $("#mymoney").hide();
        $("#mconform").hide();
        $("#msecond").show();


        myIdleGoods();

    })
    //点击关注列表
    $(".fri").click(function () {
        $("#mset").hide();
        $("#msecond").hide();

        $("#mnotice").hide();
        $("#mstore").hide();
        $("#mymoney").hide();
        $("#mconform").hide();
        $("#mfri").show();
        allFocus();
    })

    //点击个人设置
    $(".set").click(function () {

        $("#msecond").hide();
        $("#mfri").hide();
        $("#mnotice").hide();
        $("#mstore").hide();
        $("#mymoney").hide();
        $("#mconform").hide();
        $("#mset").show();
        getPeoInfos();
    })
    //点击订单中心
    $(".notice").click(function () {
        $("#mset").hide();
        $("#msecond").hide();
        $("#mfri").hide();

        $("#mstore").hide();
        $("#mymoney").hide();
        $("#mconform").hide();
        $("#mnotice").show();
        getOrderses();
    })
    //点击我的钱包
    $(".money").click(function () {
        $("#mset").hide();
        $("#msecond").hide();
        $("#mfri").hide();
        $("#mnotice").hide();
        $("#mstore").hide();
        $("#mconform").hide();
        $("#mymoney").show();
    })


    function getOrderses() {
        $.ajax({
            type: "post",
            url: "/orders/getOrderses",
            dataType: "json",
            success: function (data) {
                $(".myjob tr:not(:first-child)").remove();

                var data=data.data;
                console.log(data)
                var html="";
                for (let i = 0; i < data.length; i++) {
                    html+=`<tr align="center">
                <td>${data[i].orderNum}</td>
                <td class="ming">${data[i].goodsName}</td>
                <td>${data[i].orderPrice}</td>
                <td class="beizhu">${data[i].orderInformation}</td>
                <td><button>待发货</button></td>
            </tr>`
                }
                $(html).appendTo(".myjob");
            }
        });
    }

    //删除我的闲置
    function removeGoods(goodsId){
        $.ajax({
            type: "post",
            url: "/goods/removeGoods",
            data:{
                goodsId:goodsId
            },
            dataType: "json",
            success: function (data) {
                if(data.code==1){
                    layer.open({
                        title: '信息',
                        content: '删除成功！',
                        yes:function () {
                            window.location.href="/user?myFree=1";
                        }
                    }); 
                }else{
                    layer.open({
                        title: '信息',
                        content: '删除失败！'
                    });
                }
            }
        });
    }
    $("body").on("click",".delete",function () {
        removeGoods($(this).data("id"));
    });
</script>
</body>

</html>